<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of GetYahoo
 *
 * @author mateusz.ledzewicz
 */
class GetYahoo extends AbstractGet {
   
 
    
    protected function init($dateFrom, $dateTo, $instrumentType, $isin) {
      
       
        $from       = explode('-', $dateFrom);        
        $to         = explode('-', $dateTo);         
                
        $fromDay    = $from[2];
        $fromMonth  = sprintf("%02s", $from[1]-1);
        $fromYear   = $from[0];
        
        $toDay      = $to[2];
        $toMonth    = sprintf("%02s", $to[1]-1);
        $toYear     = $to[0];
        $this->data = file_get_contents('http://real-chart.finance.yahoo.com/table.csv?s='.$isin.'&a='.$fromMonth.'&b='.$fromDay.'&c='.$fromYear.'&d='.$toMonth.'&e='.$toDay.'&f='.$toYear.'&g=d&ignore=.csv', false);
        
    }

    protected function createMapper() {
        self::$mapper= array
        (
            'date'                      => 0,
            'openPrice'                 => 1,
            'highPrice'                 => 2,
            'lowPrice'                  => 3,
            'closePrice'                => 4,
            'volume'                    => 5
        );
        
    }
    

    
}

?>
